# Maintainer: Daniel Bermond <dbermond@archlinux.org>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - explicitly link v5/v6 with libatomic

pkgname=avisynthplus
pkgver=3.7.0
pkgrel=1
pkgdesc='An improved version of the AviSynth frameserver'
arch=('x86_64')
url='https://avs-plus.net/'
license=('GPL')
depends=('gcc-libs')
optdepends=('devil: for ImageSeq plugin')
makedepends=('cmake' 'devil')
source=("https://github.com/AviSynth/AviSynthPlus/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha256sums=('8906d9e46dc90a194413d69b710e3106c0aafddc0c5c62004885d0c3beb79862')

build() {
    [[ $CARCH == "arm" || $CARCH == "armv6h" ]] && echo "target_link_libraries(AvsCore atomic)" >> "AviSynthPlus-${pkgver}/avs_core/CMakeLists.txt"
    cmake -B build -S "AviSynthPlus-${pkgver}" \
        -DCMAKE_BUILD_TYPE:STRING='None' \
        -DCMAKE_INSTALL_PREFIX:PATH='/usr' \
        -Wno-dev
    make -C build
}

package() {
    make -C build DESTDIR="$pkgdir" install
}
